﻿<%@ page title="" language="C#" masterpagefile="baseMasterPage.master" autoeventwireup="true" inherits="th_user_thcx, App_Web_cphtqxoh" %>
<%@ Register src="WebUserControl/LoginCard2.ascx" tagname="LoginCard" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript">
    function __cardloginchecker(evt) {
        if (jsformcheck(evt, "formCard")) {
            $ajax.load({ url: "logincheckcard.aspx", data: "logincardnum=" + $("#logincardnum").val() + "&logincardpassword=" + $("#logincardpassword").val(), method: "post", type: "json" });
            //alert($ajax.responseJson.state);

            if ($ajax.responseJson.state == -100) {
                tipsShow("*该卡不存在或无效卡。"); 
            }
            else {

                if ($ajax.responseJson.state == 0) {
                    tipsShow("*该卡未激活，不能进行提货查询。");
                }
                else if ($ajax.responseJson.state == 1) {
                tipsShow("<br/><br/><p>*该卡为有效卡，还未申请提货，请先申请提货后再查询。</p><p>如需申请提货，请点击<a href=\"usertihuo.aspx\" style=\"color:blue\">这里</a>。</p><br/><br/>");
                    //如需提货，请点击<a href=\"usertihuo.aspx\" style=\"color:blue\">这里</a>
                }
                else if ($ajax.responseJson.state == 2) {

                    $ajax.load({ url: "admin/xmlcard.aspx", data: "datatype=json&cardnum=" + $("#logincardnum").val(), method: "get", type: "json" });

                    var _html = "<br /><br /><fieldset class=\"fieldsetinfo\"><legend>快递信息</legend><p>快递公司:{express}</p><p>快递单号:{expressnum}</p><p>寄出时间:{expresstime}</p></fieldset>";
                    var v1 = unescape($ajax.responseJson[0].express).toString().trim();
                    var v2 = unescape($ajax.responseJson[0].expressnum).toString().trim();
                    var v3 = unescape($ajax.responseJson[0].expresstime).toString().formatToDate();
                    if (v1 == "null") {
                        v1 = "";
                    }
                    if (v2 == "null") {
                        v2 = "";
                    }
                    _html = _html.replace("{express}", v1);
                    _html = _html.replace("{expressnum}", v2);
                    _html = _html.replace("{expresstime}", v3);

                    __showDetail(_html + "<br/><br/><br/>*您已经成功申请提货，工作人员会及时安排发货。");
                }
                else if ($ajax.responseJson.state == 3) {

                    $ajax.load({ url: "admin/xmlcard.aspx", data: "datatype=json&cardnum=" + $("#logincardnum").val(), method: "get", type: "json" });

                    var _html = "<br /><br /><fieldset class=\"fieldsetinfo\"><legend>快递信息</legend><p>快递公司:{express}</p><p>快递单号:{expressnum}</p><p>寄出时间:{expresstime}</p></fieldset>";
                    _html = _html.replace("{express}", unescape($ajax.responseJson[0].express));
                    _html = _html.replace("{expressnum}", unescape($ajax.responseJson[0].expressnum));
                    _html = _html.replace("{expresstime}", unescape($ajax.responseJson[0].expresstime).toString().formatToDate());

                    __showDetail(_html + "<br/><br/><br/>*您已经完成提货申请，工作人员已发货。");
                }
                else if ($ajax.responseJson.state == 4) {
                    $ajax.load({ url: "admin/xmlcard.aspx", data: "datatype=json&cardnum=" + $("#logincardnum").val(), method: "get", type: "json" });

                    var _html = "<br /><br /><fieldset class=\"fieldsetinfo\"><legend>快递信息</legend><p>快递公司:{express}</p><p>快递单号:{expressnum}</p><p>寄出时间:{expresstime}</p></fieldset>";
                    _html = _html.replace("{express}", unescape($ajax.responseJson[0].express));
                    _html = _html.replace("{expressnum}", unescape($ajax.responseJson[0].expressnum));
                    _html = _html.replace("{expresstime}", unescape($ajax.responseJson[0].expresstime).toString().formatToDate());
                    __showDetail(_html + "<br/><br/><br/>*工作人员已完成发货、客户收货确认。");
                }

            }
        }
        return false;
    }

    function __showDetail(shtml) {
        
        $('#dialog2 .tips2').html(shtml);
        $form.ElementsDataFromXML("formtihuokacard", "admin/xmlcard.aspx?cardnum=" + $("#logincardnum").val());

        var t = "truename,phone,address,postcode".split(",");
        var i;
        for (i = 0; i < t.length; i++) {

            $("#" + t[i] + "_text").html($("#" + t[i]).val());
        }
        $("#sex_text").html($form.getRadioValue("sex"));

        $('#dialog2').dialog({
            autoOpen: true,
            width: 670,
            resizable: false,
            modal: true,
            title: "温馨提示"
        });
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="UI_solo">
        <uc1:LoginCard ID="LoginCard21" runat="server" />
    </div>
    <div id="dialog" class="X-dialog">
        <form id="formtihuokacard" onsubmit="javascript:return tihuo_action(event);" method="post">
            <table>
                <tr>
                    <td class="fieldItem">姓名</td>
                    <td><input type="text" id="truename" name="truename" nullabled="false" maxlength="50" datatype="string" alerttext="姓名"/></td>
                </tr>
                <tr>
                    <td class="fieldItem">性别</td>
                    <td><input type="radio" name="sex" nullabled="false" alerttext="请选择性别" value="男"/>男<input type="radio" name="sex" value="女"/>女</td>
                </tr>
                <tr>
                    <td class="fieldItem">联系电话</td>
                    <td><input type="text" id="phone" name="phone" nullabled="false" maxlength="50" datatype="string" alerttext="联系电话"/></td>
                </tr>
                <tr>
                    <td class="fieldItem">收货地址</td>
                    <td><input type="text" id="address" name="address" nullabled="false" maxlength="255" datatype="string" alerttext="收货地址"/></td>
                </tr>
                <tr>
                    <td class="fieldItem">邮编</td>
                    <td><input type="text" id="postcode" name="postcode" nullabled="false" maxlength="50" datatype="string" alerttext="邮编"/></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input id="cardnum" name="cardnum" type="hidden" value="" />
                        <input id="updatemode" name="updatemode" type="hidden" value="0" />
                        <input type="submit" value="提交" class="btn2" />
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div id="dialog2" class="X-dialog">
        <br /><br />
        <fieldset class="fieldsetinfo"><legend>您的提货信息</legend>
            <p>姓名：<span id="truename_text"></span></p>
            <p>性别：<span id="sex_text"></span></p>
            <p>联系电话：<span id="phone_text"></span></p>
            <p>寄送地址：<span id="address_text"></span></p>
            <p>邮编：<span id="postcode_text"></span></p>
        </fieldset>
         <div class="tips2"></div>
    </div>
</asp:Content>

